extends Node2D

var level_num:int

signal level_start_signal

var current_prop:Object
export(PackedScene) var prop_tscn

func _ready():
	level_num = self.filename.to_int()
	$Info.set_level_num(level_num)
	_level_show_ani()

func _level_show_ani():
	$Curtain.show_ani()

func level_start():
	emit_signal("level_start_signal")
	
func level_win():
	yield(get_tree().create_timer(4.0),"timeout")
	print("res://Levels/Level"+("%02d" % level_num)+".tscn")
	var _e= get_tree().change_scene("res://Levels/Level"+("%02d" % (level_num+1))+".tscn")

func add_prop():
	if current_prop!=null and is_instance_valid(current_prop):
		current_prop.queue_free()
	current_prop = prop_tscn.instance()
	call_deferred("add_child",current_prop)
